/' Copyright (c) 2007 Scott Lembcke
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 '/

'' Axis structure used by cpPolyShape.
type cpPolyShapeAxis
	'' normal
	as cpVect	n
	'' distance from origin
	as cpFloat	d
end type

' Convex polygon shape structure.
type cpPolyShape
	as cpShape	shape
	
	'' Vertex and axis lists.
	as integer				numVerts
	as cpVect ptr			verts
	as cpPolyShapeAxis ptr	axes

	'' Transformed vertex and axis lists.
	as cpVect ptr			tVert
	as cpPolyShapeAxis ptr	tAxes
end type

'' Allocate a polygon shape.
declare function cpPolyShapeAlloc cdecl alias "cpPolyShapeAlloc" ( ) as cpPolyShape ptr
'' Initialize a polygon shape.
'' The vertexes must be convex and have a clockwise winding.
declare function cpPolyShapeInit cdecl alias "cpPolyShapeInit" ( byval as cpPolyShape ptr, byval as cpBody ptr, byval as integer, byval as cpVect ptr, byval as cpVect ) as cpPolyShape ptr
'' Allocate and initialize a polygon shape.
'' The vertexes must be convex and have a clockwise winding.
declare function cpPolyShapeNew cdecl alias "cpPolyShapeNew" ( byval as cpBody ptr, byval as integer, byval as cpVect ptr, byval as cpVect ) as cpShape ptr

'' Initialize a box shaped polygon shape.
declare function cpBoxShapeInit cdecl alias "cpBoxShapeInit" ( byval as cpPolyShape ptr, byval as cpBody ptr, byval as cpFloat, byval as cpFloat ) as cpPolyShape ptr
'' Initialize an offset box shaped polygon shape.
declare function cpBoxShapeInit2 cdecl alias "cpBoxShapeInit2" ( byval as cpPolyShape ptr, byval as cpBody ptr, byval as cpBB ) as cpPolyShape ptr
'' Allocate and initialize a box shaped polygon shape.
declare function cpBoxShapeNew cdecl alias "cpBoxShapeNew" ( byval as cpBody ptr, byval as cpFloat, byval as cpFloat ) as cpShape ptr
'' Allocate and initialize an offset box shaped polygon shape.
declare function cpBoxShapeNew2 cdecl alias "cpBoxShapeNew2" ( byval as cpBody ptr, byval as cpBB ) as cpShape ptr

'' Check that a set of vertexes has a correct winding and that they are convex
declare function cpPolyValidate cdecl alias "cpPolyValidate" ( byval as const cpVect ptr, byval as const integer ) as cpBool

declare function cpPolyShapeGetNumVerts cdecl alias "cpPolyShapeGetNumVerts" ( byval as cpShape ptr ) as integer
declare function cpPolyShapeGetVert cdecl alias "cpPolyShapeGetVert" ( byval as cpShape ptr, byval as integer ) as cpVect

